/**
 * 公共基础接口封装
 */
 import form from "../views/login/login.vue"
 import { Status } from "@vueuse/core";
 import console from "console";
 import request from "../utils/request";
 
 
 //登录业务
 interface ResponseData<T=any>{
     status:number
     token:string
     title:string
 }
 export const  postLogin =async (
     data:{
         
         email:string
         password:string
     }
 
 )=>{
 
     const res = await request.post<ResponseData>(
         '/api/auth/login',
         data
 
     );
     return res.data;
 
 }
 //发送验证码业务
 export const postToRegister=async (
     data:{
 
         email:string
     }
 )=>{
     const res = await request.post<ResponseData>(
         `/api/user/${data.email}/Register`,
         data
     );
     return res.data;
    
 }
 //注册
 export const  Register =async (
     data:{
         
         email:string
         password:string
         confirmPassword:string
         code:string
     }
 
 )=>{
 
     const res = await request.post<ResponseData>(
         '/api/auth/register',
         data
 
     );
     return res.data;
 
 }

 //忘记密码验证码
 export const postToForget=async (
     data:{
 
         email:string
     }
 )=>{
     const res = await request.post<ResponseData>(
         `/api/user/${data.email}/Password`,
         data
     );
     return res.data;
    
 }

 //忘记密码
 export const  Forget =async (
     data:{
         
         email:string
         password:string
         confirmPassword:string
         code:string
     }
 
 )=>{
 
     const res = await request.post<ResponseData>(
         '/api/auth/Password',
         data
 
     );
     return res.data;
 
 }
 
//  
export const getUserSimplifyMessage =()=>{
    
    
    return request(
    {
        method:'GET',
        url:'/api/user',
        
    })
}


